﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
   public class ViTriLuuTru_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_ViTriLuuTru");
       }
       public int Insert(ViTriLuuTru_Public maViTri, ViTriLuuTru_Public tenViTri, ViTriLuuTru_Public moTa)
       {
           int Npara = 3;
           string[] name = new string[Npara];
           object[] value = new object[Npara];
           name[0] = "@MaViTri";
           value[0] = maViTri.MaViTri;
           name[1] = "@TenViTri";
           value[1] = tenViTri.TenViTri;
           name[2] = "@MoTa";
           value[2] = moTa.MoTa;

           return kn.update("Insert_ViTriLuuTru", name, value, Npara);

       }
       public int Update(ViTriLuuTru_Public maViTri, ViTriLuuTru_Public tenViTri, ViTriLuuTru_Public moTa)
       {
           int Npara = 3;
           string[] name = new string[Npara];
           object[] value = new object[Npara];
           name[0] = "@MaViTri";
           value[0] = maViTri.MaViTri;
           name[1] = "@TenViTri";
           value[1] = tenViTri.TenViTri;
           name[2] = "@MoTa";
           value[2] = moTa.MoTa;

           return kn.update("Update_ViTriLuuTru", name, value, Npara);

       }
       public int Delete(ViTriLuuTru_Public maViTri)
       {
           int Npara = 1;
           string[] name = new string[Npara];
           object[] value = new object[Npara];
           name[0] = "@MaViTri";
           value[0] = maViTri.MaViTri;

           return kn.update("Delete_ViTriLuuTru", name, value, Npara);

       }
    }
}
